<style lang="scss" scoped>
  @import '../../styles/common/loading.less';
  .container{
    border: none !important;
    margin-top: 4px;
  }
  .el-col-offset-1 {
    margin-left: 0%;
  }
  .button_a {
    background-color: rgba(255, 138, 0, 1);
    border-color: rgba(255, 138, 0, 1);

  }
  .col_a {
    margin-left: 2%;
  }
  .el-card {
    height: 200px;
  }

  .el-button--primary {
    background-color: rgba(255, 138, 0, 1);
    border-color: rgba(255, 138, 0, 1);
  }
</style>
<template>
  <div  class="common-background-color">
    <div style="width:98%;margin: 6px 12px;">
      <el-collapse v-model="activeNames" v-if="this.item1===0" >
        <el-collapse-item title="注销信息"  name="1">
          <div class="container" style="width: 100%;">
              <template>
                <el-form ref="formInline" :model="form"  class="info-submit-form">
                  <el-row type="flex">
                    <el-col :span="8">
                      <el-form-item label="大病赔案号">
                        <el-input v-model="form.caseNo"  disabled></el-input>
                      </el-form-item>
                    </el-col>
                    <el-col :span="8">
                      <el-form-item label="保单号">
                        <el-input v-model="form.policyNo"  disabled></el-input>
                      </el-form-item>
                    </el-col>
                    <el-col :span="8">
                      <el-form-item label="社/医保号">
                        <el-input v-model="form.socialSecurityNo"  disabled></el-input>
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row type="flex">
                    <el-col :span="8">
                      <el-form-item label="被保险人">
                        <el-input v-model="form.insuredName"  disabled></el-input>
                      </el-form-item>
                    </el-col>
                    <el-col :span="8"  >
                      <el-form-item label="证件类型">
                        <el-input v-model="form.documentType"  disabled></el-input>
                      </el-form-item>
                    </el-col>
                    <el-col :span="8" >
                      <el-form-item label="证件号">
                        <el-input v-model="form.documentNo"  disabled></el-input>
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row type="flex">
                    <el-col :span="8">
                      <el-form-item label="注销原因" :required="true">
                        <el-select v-model="form.cancelReason" disabled placeholder="请选择状态">
                          <el-option
                            v-for="item in CancelReason"
                            :key="item.codeCode"
                            :label="item.codeCName"
                            :value="item.codeCode">
                          </el-option>
                        </el-select>
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row type="flex">
                    <el-col :span="24" >
                      <el-form-item label="注销详情" :required="true">
                        <el-input show-word-limit disabled v-model="form.cancelDescribe" type="textarea" ></el-input>
                      </el-form-item>
                    </el-col>
                  </el-row>
                </el-form>
              </template> 
          </div>     
        </el-collapse-item>
        <el-collapse-item title="审核意见" name="2">
          <div class="container" style="width: 100%;">
            <template>
              <el-tabs style="width: 100%;">
                  <el-card class="box-card" style="">
                    <div>
                      审核意见：
                      <template>
                        <el-radio v-model="auditOpinion" label="03">同意</el-radio>
                        <el-radio v-model="auditOpinion" label="04">退回</el-radio>
                      </template>
                      <br>
                      <br>
                      <div>
                        <el-input v-model="remark">
                          <template slot="prepend">注销备注</template>
                        </el-input>
                      </div>
                      <br>
                      <div>
                        <el-input v-model="evaluate">
                          <template slot="prepend">评价短语</template>
                        </el-input>
                      </div>
                    </div>
                  </el-card>
              </el-tabs>
            </template>
          </div>
        </el-collapse-item>
      </el-collapse>
      <el-collapse v-model="activeNames" v-if="this.item1===1" >
        <el-collapse-item title="注销信息"  name="1">
             <div class="container" style="width: 100%;">
              <template>
                <el-form ref="formInline" :model="form" label-width="90px">
                  <el-row type="flex">
                    <el-col :span="8" >
                      <el-form-item label="大病赔案号">
                        <el-input v-model="form.caseNo"  disabled></el-input>
                      </el-form-item>
                    </el-col>
                    <el-col :span="8" >
                      <el-form-item label="保单号">
                        <el-input v-model="form.policyNo"  disabled></el-input>
                      </el-form-item>
                    </el-col>
                    <el-col :span="8"  >
                      <el-form-item label="社/医保号">
                        <el-input v-model="form.socialSecurityNo"  disabled></el-input>
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row type="flex">
                    <el-col :span="8">
                      <el-form-item label="被保险人">
                        <el-input v-model="form.insuredName"  disabled></el-input>
                      </el-form-item>
                    </el-col>
                    <el-col :span="8"  >
                      <el-form-item label="证件类型">
                        <el-input v-model="form.documentType"  disabled></el-input>
                      </el-form-item>
                    </el-col>
                    <el-col :span="8" >
                      <el-form-item label="证件号">
                        <el-input v-model="form.documentNo"  disabled></el-input>
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row type="flex">
                    <el-col :span="8">
                      <el-form-item label="注销原因" :required="true">
                        <el-select v-model="form.cancelReason"  disabled>
                          <el-option
                            v-for="item in CancelReason"
                            :key="item.codeCode"
                            :label="item.codeCName"
                            :value="item.codeCode">
                          </el-option>
                        </el-select>
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row type="flex">
                    <el-col :span="24" >
                      <el-form-item label="注销详情" :required="true">
                        <el-input show-word-limit disabled v-model="form.cancelDescribe" type="textarea"></el-input>
                      </el-form-item>
                    </el-col>
                  </el-row>
                </el-form>
              </template>
            </div>
        </el-collapse-item> 
          <!-- 审核意见 -->
        <el-collapse-item title="审核意见" name="2">
          <div class="container" style="width: 100%;">
            <template>
              <el-tabs   style="width: 100%;">
                  <el-card class="box-card" style="">
                    <div>
                      审核意见：
                      <template>
                        <el-radio v-model="auditOpinion" disabled label="03">同意</el-radio>
                        <el-radio v-model="auditOpinion" disabled label="04">退回</el-radio>
                      </template>
                      <br>
                      <br>
                      <div>
                        <el-input :disabled="true" v-model="remark">
                          <template slot="prepend">注销备注</template>
                        </el-input>
                      </div>
                      <br>
                      <div>
                        <el-input :disabled="true" v-model="evaluate">
                          <template slot="prepend">评价短语</template>
                        </el-input>
                      </div>
                    </div>
                  </el-card>
              </el-tabs>
            </template>
          </div>
        </el-collapse-item>
      </el-collapse>
      <div slot="footer" style="text-align: center;margin-top: 50px" class="dialog-footer">
        <el-button type="primary" size="medium">放弃任务</el-button>
        <el-button type="success" v-if="this.item1===0" @click="save()">提  交</el-button>
        <el-button type="info" @click="researchCheckSearch()">关  闭</el-button>
      </div>
    </div>
    <el-dialog
      :visible.sync="Successdialog"
      :show-close="false"
      :close-on-click-modal="true"
      :close-on-press-escape="false"
      width="20%"
      center>
      <div style="margin-top: -35px;">
        <div>| 调查审核提交</div>
        <hr style="width: 80%;margin-left: 1px">
      </div>
      <div v-if="this.item===0" style="text-align: center;margin-top: 20px">
        <img src="../../assets/images/pass.png" width="60">
        <div style="margin-top: 10px">提交成功</div>
        <div style="margin-top: 10px">大病赔案号：{{form.caseNo}}</div>
      </div>
      <div v-if="this.item===1" style="text-align: center;margin-top: 20px">
        <img src="../../assets/images/notPass.png" width="60">
        <div style="margin-top: 10px">提交失败</div>
        <div style="margin-top: 10px">大病赔案号：{{form.caseNo}}</div>
      </div>
      <div style="margin-top: 15px;text-align: center"><span style="font-size: x-large">{{time}}</span>秒后跳转到上一个页面</div>
      <div slot="footer" class="dialog-footer">
        <el-button @click="researchCheckSearch" type="text">关闭</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import * as api from '@/api/baseDate'
export default {
    name: 'caseCancelAuditDetail',
    data() {
      return {
        auditOpinion:'',
        remark:'',
        evaluate:'',
        Successdialog:false,
        query: {
          address: '',
          name: '',
          pageIndex: 1,
          pageSize: 10
        },
        CancelReason:[],
        item:0,

        dialogFormVisible:false,
        activeNames: ['1','2'],
        //控制显示隐藏
        isBase:false,
        isSurvey:false,
        shenheyijian:"1",
        activeName: 'first',
        multipleSelection: [],
        delList: [],
        editVisible: false,
        pageTotal: 0,
        form: {
        },
        time:0,
        idx: -1,
        id: -1,
        formInline: {
          policy: '20143301000000008',
          startDate: '2019-01-01',
          endDate: '2022-01-01',
          insurePlan: '徐州医保局',
        },
        researchHistory:[],
        IdentifyType:[],
      };
    },
    created() {
      this.CancelReason1();
      // this.IdentifyType1();
      this.form=JSON.parse(this.$route.query.taskDispose)
      // this.documentType1(this.form.documentType);
      // this.documentType1('110001')
      this.item1=JSON.parse(this.$route.query.item)
      this.auditOpinion=this.form.auditOpinion
      this.evaluate=this.form.evaluate
      this.remark=this.form.remark
      console.log("123"+this.form)
    },
    methods: {
      save(){
        api.getAuditCaseCancel({
          "head": {
          },
          "body": {
            "id":this.form.id,
            'caseNo':this.form.caseNo,
            'auditOpinion':this.auditOpinion,
            'remark':this.remark,
            'evaluate':this.evaluate,
            "flowId":this.form.flowId,
            "taskState":this.form.taskState,
          }
        }).then(res => {
          this.Successdialog=true
          // 把time改为5
          this.time = 5;
          // 设定一个定时器，每一秒调用一次coundDown方法，time-1
          setInterval(this.countDown, 1000);
        }).catch((function () {
            /*let THIS = this;*/
            this.item=1,
              this.Successdialog=true
            // 把time改为5
            this.time = 5;
            // 设定一个定时器，每一秒调用一次coundDown方法，time-1
            setInterval(this.countDown, 1000);
          }),
        )
      },
      documentType1(documentType){
        alert('456132')
        for(var i=0;i<this.IdentifyType.length;i++){
          alert("1234")
          for(var IdentifyType in this.IdentifyType[i]){
            alert("132")
            alert(IdentifyType.codeCode)
            if(documentType===IdentifyType.codeCode){
              alert("12")
              alert(documentType)
              // return this.IdentifyType.codeCName;
              return "组织机构代码";
            }
          }
        }
      },
      // 原因
      CancelReason1(){
        var data={
          "codeType": "CancelReason"
        }
        api.MedType(data
        ).then(res => {
          // debugger
          this.CancelReason=res.data
        })
      },
      // 证件类型
      IdentifyType1(){
        var data={
          "codeType": "IdentifyType"
        }
        api.MedType(data
        ).then(res => {
          // debugger
          this.IdentifyType=res.data
          console.log("证件类型"+this.IdentifyType)
        })
      },
      researchStart(){
        this.$router.go(-1)
      },
      isBaseInfo(){
        this.isBase=!this.isBase;
      },
      surveyHistory(){
        this.isSurvey=!this.isSurvey;
      },
      // 分页导航
      handlePageChange(val) {
        this.$set(this.query, 'pageIndex', val);
        this.getData();
      },
      onSubmit() {
        console.log('submit!');
      },
      researchCheckSearch(){
        // this.$router.go(-1)
       // this.$router.push({name:'caseCancelAudit'});
        this.closePageTo(this.$store,this.$route,this.$router,'caseCancelAudit');
      },
//   封装一个方法
      countDown() {
        this.time--;
      },
    },
    watch: {
      //   监听time的值
      time: function (newVal) {
        if (newVal == 0) {
            //this.$router.push({name:'caseCancelAudit'});
            this.closePageTo(this.$store,this.$route,this.$router,'caseCancelAudit');
        }
      },
    },
  };
</script>